<template>
  <div>
    <!-- 头部导航 -->
    <div class="hearder">
      <div class="button" @click="$router.go(-1)">
        <span class="iconfont icon-fanhui"></span>
      </div>
      <div class="center">推荐MV</div>
      <router-link
        tag="div"
        to="/search"
        class="right iconfont icon-sousuo"
      ></router-link>
    </div>
    <!-- 导航按钮 -->
    <div class="navs">
      <router-link tag="div" to="/recommend" class="item">
        <span>推荐</span>
      </router-link>
      <router-link tag="div" to="/rank" class="item">
        <span>排行榜</span>
      </router-link>
      <router-link tag="div" to="/singer" class="item">
        <span>歌手</span>
      </router-link>
    </div>
    <!-- 推荐内容 -->
    <div class="viedobox">
      <div class="videocon" v-for="item in title" :key="item.id">
        <router-link class="img" tag="div" :to="'/mvsublist?id=' + item.id">
          <img :src="item.cover" alt="" />
        </router-link>
        <div class="videoname">
          {{ item.name }}
          <!-- <span>邓紫棋</span> -->
        </div>
        <div class="iconfont icon-erji1 timename">
          {{ item.playCount | playCountData }}
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { getMvAll } from "../api/userinfo";
export default {
  data: function () {
    return {
      title: [], //视频列表
    };
  },
  components: {
    // headerNav,
  },

  created() {
    //获取新音乐数据
    getMvAll({ limit: 30 }).then((data) => {
      console.log(data.data);
      this.title = data.data;
    });
  },

  methods: {
    setId(id) {
      // 播放全部歌曲
      this.$emit("get-player-id", id);
    },
  },
  filters: {
    playCountData(value) {
      let w = value > 10000 ? value / 10000 : value; //万计算
      let y = w > 10000 ? parseInt(value / 10000) + "亿" : parseInt(w) + "万";
      return y;
    },
  },
};
</script>

<style lang="less">
.hearder {
  background-color: #d44439;
  color: #fff;
  height: 39px;
  line-height: 39px;
  display: flex;
  text-align: center;
  .button {
    width: 45px;
    height: 45px;
    line-height: 45px;
    text-align: center;
    font-size: 16px;
    color: white;
    span {
      font-weight: bolder;
      font-size: 20px;
    }
  }
  .center {
    flex: 1;
  }
}
.viedobox {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  padding-bottom: 50px;

  .videocon {
    padding: 15px 9px 35px 9px;
    width: 45%;
    height: 80px;
    position: relative;

    img {
      width: 100%;
      height: 90px;
      border-radius: 10px;
      background: violet;
      .img {
        width: 100%;
        height: 100%;
        border-radius: 5px;
      }
    }
    .videoname {
      padding-top: 10px;
      font-size: 14px;
      color: #4a4848;
      line-height: 16px;
      font-weight: 500;
      height: 16px;
      width: 100%;
      overflow: hidden;

      span {
        font-size: 12px;
        padding-left: 10px;
        color: #666;
      }
    }
    .timename {
      position: absolute;
      font-size: 12px;
      font-weight: 800;
      top: 14%;
      color: #ffffff;
      right: 8%;
    }
  }
}
</style>